<?php

namespace app\common\model;

use think\Model;

class TopicClass extends Model
{
    //获取话题分类
    public function getTopicClassList()
    {
        return $this->field(['id', 'classname'])->where(['status' => '1'])->select();
    }
    // 关联话题
    public function topic()
    {
        return $this->hasMany('Topic');
    }

    // 获取指定话题分类下的话题列表
    public function getTopic()
    {
        // 获取所有参数
        $param = request()->param();
        return $this->get($param['id'])->topic()->page($param['page'],10)->select();
    }
}
